package com.WaVel.mapper;

import com.Emplyment.dto.QuestionBankDto;
import com.Emplyment.entity.QuestionBank;
import com.Emplyment.enumeration.OperationType;
import com.Emplyment.vo.QuestionBankVo;
import com.WaVel.annotation.AutoFill;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface QuestionBankMapper {

    @Select("SELECT * FROM question_bank where category = #{selectedCareer}")
    List<QuestionBankVo> getQuestionBank(String selectedCareer);

    @Select("SELECT * FROM question_bank")
    List<QuestionBankVo> getAllQuestionBank();

    @AutoFill(value = OperationType.INSERT)
//    @Insert("INSERT INTO question_bank (question, answer, category,difficulty,createTime,updateTime) VALUES (#{question}, #{answer}, #{category},#{difficulty},#{createTime},#{updateTime})")
    void addQuestion(QuestionBank questionBank);

    @Delete("DELETE FROM question_bank WHERE id = #{id}")
    void deleteQuestion(Integer id);

    @AutoFill(value = OperationType.UPDATE)
    @Update("update question_bank set question = #{question}, answer = #{answer}, category = #{category}, difficulty = #{difficulty},updateTime = #{updateTime} where id = #{id}")
    void updateQuestion(QuestionBank questionBank);

}
